import Vue from "vue";
import VueRouter from "vue-router";
import login from '../components/pages/login.vue'
import data from '../components/pages/data/data.vue'
import blight from '../components/pages/data/blight.vue'
import disease from '../components/pages/data/disease.vue'
import rodent from '../components/pages/data/rodent.vue'
import disaster from '../components/pages/disaster/disaster.vue'
import area from '../components/pages/disaster/area.vue'
import classinfo from '../components/pages/disaster/classinfo.vue'
import event from '../components/pages/disaster/event.vue'
import expert from '../components/pages/expert/expert.vue'
import expertInfo from '../components/pages/expert/expertInfo.vue'
import consul from '../components/pages/expert/consul.vue'
import out from '../components/pages/out/out.vue'
import outgallery from '../components/pages/out/outgallery.vue'
import goods from '../components/pages/out/goods.vue'
import user from '../components/pages/user/user.vue'
import usermanage from '../components/pages/user/usermanage.vue'
import log from '../components/pages/user/log.vue'
import userblight from '../components/pages/user/data/blight.vue'
import userdisease from '../components/pages/user/data/disease.vue'
import userrodent from '../components/pages/user/data/rodent.vue'
import userarea from '../components/pages/user/disaster/area.vue'
import userclassinfo from '../components/pages/user/disaster/classinfo.vue'
import userevent from '../components/pages/user/disaster/event.vue'
import userexpertInfo from '../components/pages/user/expert/expertInfo.vue'
import userconsul from '../components/pages/user/expert/consul.vue'
import usergoods from '../components/pages/user/out/goods.vue'
import useroutgallery from '../components/pages/user/out/outgallery.vue'
// 导入需要配置的路由组件


Vue.use(VueRouter)

// 创建常量 配置路由和组件的映射
const routes = [
    { path: "/login", component: login },
    //资料管理员
    { path:"/data", component: data,
        children:[
            {path:"/data/blight", component: blight},
            {path:"/data/disease", component: disease},
            {path:"/data/rodent", component: rodent}
        ]
    },
    //灾情管理员
    { path:"/disaster", component: disaster,
        children:[
            {path:"/disaster/area", component: area},
            {path:"/disaster/classinfo", component: classinfo},
            {path:"/disaster/event", component: event}
        ]
    },
    //专家管理员
    { path:"/expert", component: expert,
        children:[
            { path:"/expert/expertInfo", component: expertInfo},
            { path:"/expert/consul", component: consul}
        ]
    },
    //库房管理员
    { path:"/out", component: out,
        children:[
            {path:"/out/outgallery",component:outgallery},
            {path:"/out/goods",component:goods}
        ]
    },
    //超级管理员
    { path:"/user", component:user,
        children:[
            {path:"/user/usermanage",component:usermanage},
            {path:"/user/log",component:log},
            {path:"/user/data/blight", component: userblight},
            {path:"/user/data/disease", component: userdisease},
            {path:"/user/data/rodent", component: userrodent},
            {path:"/user/disaster/area", component: userarea},
            {path:"/user/disaster/classinfo", component: userclassinfo},
            {path:"/user/disaster/event", component: userevent},
            { path:"/user/expert/expertInfo", component: userexpertInfo},
            { path:"/user/expert/consul", component: userconsul},
            {path:"/user/out/outgallery",component:useroutgallery},
            {path:"/user/out/goods",component:usergoods}
        ]
    }
]

// 建立router对象
export default new VueRouter({
    mode:'history',
    routes
})